project(score_addons LANGUAGES CXX)

if(SCORE_FAST_DEV_BUILD)
  return()
endif()

macro(SUBDIRLIST result curdir)
  file(GLOB children RELATIVE ${curdir} ${curdir}/*)
  set(dirlist "")
  foreach(child ${children})
    if(IS_DIRECTORY ${curdir}/${child})
        list(APPEND dirlist ${child})
    endif()
  endforeach()
  set(${result} ${dirlist})
endmacro()

subdirlist(SUBDIRS "${CMAKE_CURRENT_SOURCE_DIR}")
set(SCORE_ADDON True)
foreach(subdir ${SUBDIRS})
  if(NOT "${subdir}" IN_LIST SCORE_DISABLED_PLUGINS)
    if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/CMakeLists.txt")
      message(" -- score: configuring ${subdir}")
      add_subdirectory("${subdir}")
    endif()
  endif()
endforeach()
